IDENTITY
The IDENTITY function returns an identity array (an array with ones along the main diagonal and zeros elsewhere) of the specified dimensions.
This routine is written in the IDL language. Its source code can be found in the file identity.pro
in the lib
subdirectory of the IDL distribution.
Examples
; Define an array, A:
A = [[ 2.0, 1.0, 1.0, 1.5], $
[ 4.0, -6.0, 0.0, 0.0], $
[-2.0, 7.0, 2.0, 2.5], $
[ 1.0, 0.5, 0.0, 5.0]]
; Compute the inverse of A using the INVERT function:
inverse = INVERT(A)
; Verify the accuracy of the computed inverse using the
; mathematical identity, A x A^-1 - I(4) = 0, where A^-1 is the
; inverse of A and I(4) is the 4 by 4 identity array:
PRINT, A ## inverse - IDENTITY(4)
Syntax
Result = IDENTITY( N [, /DOUBLE] )
Return Value
Returns an n by n identity array.
Arguments
N
The desired column and row dimensions.
Keywords
DOUBLE
Set this keyword to return a double-precision identity array.
Version History
5.0 |
Introduced |